<html>
<head>
    <title>XamlPhysics - Joints</title>
    <script src="CodeMirror/js/highlight.js" type="text/javascript"></script>
    <script src="CodeMirror/js/stringstream.js" type="text/javascript"></script>
    <script src="CodeMirror/js/tokenize.js" type="text/javascript"></script>
    <script src="CodeMirror/js/parsexml.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="CodeMirror/css/xmlcolors.css"/>
</head>
<body>
    <h1>WeldJoint</h1>
    <p>
        A WeldJoint constrains all relative motion between two bodies.
    </p>
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=WeldJoint" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="_sl_historyFrame" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code1" cols="120" rows="15">
<Rectangle x:Name="UxBox1" Canvas.Left="380" Canvas.Top="40" Width="100" Height="100" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle x:Name="UxBox2" Canvas.Left="480" Canvas.Top="90" Width="100" Height="100" Fill="DarkGreen">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>

<physics:WeldJoint Body="{Binding ElementName=UxBox1}" Body2="{Binding ElementName=UxBox2}" />

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>

    <h1>RevoluteJoint</h1>
    <p>
        A revolute joint rains two bodies to share a common point while they are free to rotate about the point.
    </p>
    <div id="Div1">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=RevoluteJoint" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="Iframe1" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code2" cols="120" rows="15">
<Rectangle x:Name="UxBox1" Canvas.Left="380" Canvas.Top="40" Width="100" Height="100" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle x:Name="UxBox2" Canvas.Left="470" Canvas.Top="90" Width="100" Height="100" Fill="DarkGreen">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>

<physics:RevoluteJoint Body="{Binding ElementName=UxBox1}" Body2="{Binding ElementName=UxBox2}" Canvas.Left="485" Canvas.Top="120" />

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>

    <h1>FixedRevoluteJoint</h1>
    <p>
        A fixed revolute joint rains a body to share a common point with the word while it is free to rotate about the point.
    </p>
    <div id="Div2">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=FixedRevoluteJoint" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="Iframe2" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code3" cols="120" rows="15">
<Rectangle x:Name="UxBox1" Canvas.Left="400" Canvas.Top="40" Width="100" Height="100" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>

<physics:FixedAngleJoint TargetAngle="45" Body="{Binding ElementName=UxBox1}" />

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>

    <h1>AngleJoint</h1>
    <p>
        An angle joint maintains a fixed angle between two bodies.
    </p>
    <div id="Div3">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=AngleJoint" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="Iframe3" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code4" cols="120" rows="15">
<Rectangle x:Name="UxBox1" Canvas.Left="400" Canvas.Top="40" Width="100" Height="100" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IgnoreGravity="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle x:Name="UxBox2" Canvas.Left="680" Canvas.Top="200" Width="100" Height="100" Fill="DarkGreen">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>

<physics:AngleJoint TargetAngle="45" Body="{Binding ElementName=UxBox1}" Body2="{Binding ElementName=UxBox2}" />

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>

    <h1>FixedAngleJoint</h1>
    <p>
        An fixed angle joint maintains a fixed angle on one body
    </p>
    <div id="Div4">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=FixedAngleJoint" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="Iframe4" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code5" cols="120" rows="15">
<Rectangle x:Name="UxBox1" Canvas.Left="400" Canvas.Top="40" Width="100" Height="100" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>

<physics:FixedAngleJoint TargetAngle="45" Body="{Binding ElementName=UxBox1}" />

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>

    <h1>LineJoint</h1>
    <p>
         A line joint provides two degrees of freedom: translation along an axis fixed in body1 and rotation in the plane.
    </p>
    <div id="Div5">
        <object data="data:application/x-silverlight-2," height="300" 
            type="application/x-silverlight-2" width="400">
            <param name="source" value="XamlPhysics.Samples.xap" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="InitParams" value="Sample=LineJoint" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
 			      <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
		      </a>
	        </object>
        <iframe id="Iframe5" 
            style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
    </div>

    <textarea id="Code6" cols="120" rows="15">
<Rectangle x:Name="UxBox1" Canvas.Left="380" Canvas.Top="40" Width="100" Height="100" Fill="DarkRed">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>
<Rectangle x:Name="UxBox2" Canvas.Left="533" Canvas.Top="90" Width="100" Height="100" Fill="DarkGreen">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody />
    </physics:PhysicalBox.Body>
</Rectangle>

<physics:LineJoint Body="{Binding ElementName=UxBox1}" Body2="{Binding ElementName=UxBox2}" Canvas.Left="430" Canvas.Top="90" />

<Rectangle Canvas.Left="-100" Canvas.Top="768" Width="1240" Height="10" Fill="Black">
    <physics:PhysicalBox.Body>
        <physics:RectangleBody IsStatic="True" />
    </physics:PhysicalBox.Body>
</Rectangle>
    </textarea>
    
    <script type="text/javascript">
        function Highlight(Code) {
            var Text = document.createElement("pre");
            Text.style.fontFamily = "Courier New";

            function AddLine(Line) {
                for (var i = 0; i < Line.length; i++) Text.appendChild(Line[i]);
                Text.appendChild(document.createElement("br"));
            }
            highlightText(Code.value, AddLine);

            Code.parentElement.insertBefore(Text, Code);
            Code.parentElement.removeChild(Code);
        }
        Highlight(document.getElementById("Code1"));
        Highlight(document.getElementById("Code2"));
        Highlight(document.getElementById("Code3"));
        Highlight(document.getElementById("Code4"));
        Highlight(document.getElementById("Code5"));
        Highlight(document.getElementById("Code6"));
    </script>
</body>
</html>